<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>

</head>
<body>
<input type="button" value="POST请求" onclick="clickPost()"><br/>
<input type="button" value="GET请求" onclick="clickGET()"><br/>
<script type="text/javascript">
    function clickPost() {
        var param={"username":"tom","password":"123456","nickname":"admin"};
        $.ajax({
            type:"POST",
            data:JSON.stringify(param),
            url:"/user/testPost",
            contentType:"application/json",
            success:function (data) {
                alert(data);
            },
            error:function (data) {
                console.log(data);
            }
        })
    }
    function clickGET() {

        $.ajax({
            type:"GET",
            url:"/user/testGet",
            contentType:"application/json",
            success:function (data) {
                console.log(data);
            },
            error:function (data) {
                console.log(data);
            }
        })
    }
</script>
</body>
</html>
